<template>
  <div class="u-p-20">
    <el-card shadow="never">
      <div slot="header">
        <span>
          <b class="u-f-16">代理商提现申请列表</b>
        </span>
        <router-link
          :to="{ name: 'agencyExtractEdit' }"
          v-if="hasPerm('agencyExtractEdit')"
        >
          <el-button
            type="danger"
            size="small"
            icon="el-icon-plus"
            class="u-right u-5mt"
            round
            >添加提现记录</el-button
          >
        </router-link>
      </div>

      <el-form
        :inline="true"
        :model="queryForm"
        size="small"
        class="u-text-center"
      >
        <el-form-item label="审核状态">
          <el-select v-model="queryForm.check" clearable>
            <el-option label="全部" value="-1"></el-option>
            <el-option label="同意" value="0"></el-option>
            <el-option label="待审核" value="1"></el-option>
            <el-option label="拒绝" value="2"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="代理商名称">
          <el-input
            v-model="queryForm.keyword"
            placeholder="输入代理商名称"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            @click="getPageData(true)"
            >查询</el-button
          >
        </el-form-item>
      </el-form>

      <el-table :data="tableData" class="u-mt-10" v-viewer>
        <el-table-column label="id" prop="id" width="100"></el-table-column>
        <el-table-column label="代理商图片">
          <template slot-scope="scope">
            <el-image
              style="max-width: 80px"
              :src="scope.row.agency_img"
              :data-src="scope.row.agency_img"
              fit="cover"
              lazy
            ></el-image>
          </template>
        </el-table-column>
        <el-table-column
          label="代理商名称"
          prop="agency_title"
        ></el-table-column>
        <el-table-column
          label="代理商个人姓名"
          prop="agency_name"
        ></el-table-column>
        <el-table-column
          label="代理商账号"
          prop="agency_login_username"
        ></el-table-column>
        <el-table-column label="提现金额" prop="price"></el-table-column>

        <el-table-column label="提现状态">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.check == 0" type="success">同意</el-tag>
            <el-tag v-if="scope.row.check == 1" type="warning">待审核</el-tag>
            <el-tag v-if="scope.row.check == 2" type="danger">拒绝</el-tag>
          </template>
        </el-table-column>

        <el-table-column label="申请时间" prop="create_date"></el-table-column>

        <el-table-column label="操作" width="120">
          <template slot-scope="scope">
            <el-button
              @click.native="handleRoute(scope.row.id, 'agencyExtractView')"
              v-if="hasPerm('agencyExtractView')"
              size="mini"
              type="text"
              >编辑/审核</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <div class="u-mt-20 u-text-center">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handlePageChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 30, 40, 50]"
          :page-size="limit"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
import commonPage from "@/mixins/common-page";
export default {
  mixins: [commonPage],
  data() {
    return {
      apiName: "agency",
      apiPage: "agencyExtractPage",
      queryForm: {
        check: "-1",
        keyword: "",
      },
    };
  },
  methods: {},
};
</script>
